// 大数据第十一题 
// author ： lbc
package homework1;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

public class movefile {
    public static void main(String[] args) throws IOException, URISyntaxException {
        Configuration conf = new Configuration();
        String hdfsPath = "hdfs://localhost:9000";
        FileSystem hdfs = FileSystem.get(new URI(hdfsPath), conf);
        String from_path = "hdfstest/input.txt";
        String to_path = "input.txt";
        if (hdfs.rename(new Path(from_path), new Path(to_path))) {
            System.out.println("move file success!");
        } else {
            System.out.println("err occured!");
        }

        hdfs.close();
    }
}
